package top.javatool.canal.example.handler;

import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;
import top.javatool.canal.example.model.User;

/**
 * @author yang peng
 * @date 2019/4/1915:19
 */
@Slf4j
@Component
@CanalTable(value = "t_user")
public class UserHandler implements EntryHandler<User> {
    @Override
    public void insert(User user) {
        log.info("insert：{}", JSON.toJSONString(user));
    }

    @Override
    public void update(User before, User after) {
        log.info("update before：{} ", JSON.toJSONString(before));
        log.info("update after：{}", JSON.toJSONString(after));
    }

    @Override
    public void delete(User user) {
        log.info("delete：{}", JSON.toJSONString(user));
    }
}
